/** 
 * Description:
 * Date:2012-6-20
 * Author:Along	
*/
package com.community.shopping.util;

public class MailTest extends Thread{
	
  private String orderno;
  
  public MailTest(String orderno)
  {
	this.orderno=orderno;
  }
	
	public boolean sendMail()
	{
		 //这个类主要是设置邮件
		  MailSenderInfo mailInfo = new MailSenderInfo(); 
		  mailInfo.setMailServerHost("smtp.189.cn"); 
		  mailInfo.setMailServerPort("25"); 
		  mailInfo.setValidate(true); 
		  mailInfo.setUserName("18028784693@189.cn"); 
		  mailInfo.setPassword("092711");//您的邮箱密码 
		  mailInfo.setFromAddress("18028784693@189.cn"); 
		 // mailInfo.setToAddress("18688946360@wo.com.cn"); 
		  mailInfo.setToAddress("18028784693@189.cn,18688946360@wo.com.cn"); 
		  mailInfo.setSubject(orderno); 
		  mailInfo.setContent(orderno); 
	        //这个类主要来发送邮件
		  SimpleMailSender sms = new SimpleMailSender();
	      return sms.sendTextMail(mailInfo);
		
	}
	
	public void run()
	{
		while(!sendMail())
		{
			System.out.println("---------------发送邮件失败------------");
			try
			{
			Thread.sleep(20000);
			}catch(Exception e)
			{
				e.printStackTrace();
			}
			
		}
	}
	
	public static void main(String args[])
	{
		
		Thread t=new MailTest("测试000000");
		t.start();
	}
}
